<template>
  <view class="experience-item">
    <view class="header">
      <view class="main-info">
        <view class="title">{{ title }}</view>
        <view class="subtitle">{{ subtitle }}</view>
      </view>
      <view class="edit-btn" @click="onEdit">
        <u-icon name="edit-pen" color="#5ac725" size="20"></u-icon>
      </view>
    </view>
    <view class="time">{{ timeRange }}</view>
    <view v-if="content" class="divider"></view>
    <view v-if="content" class="content">{{ content }}</view>
  </view>
</template>

<script setup>
const props = defineProps({
  id: {
    type: String,
    required: true
  },
  title: {
    type: String,
    required: true
  },
  subtitle: {
    type: String,
    default: ''
  },
  timeRange: {
    type: String,
    default: ''
  },
  content: {
    type: String,
    default: ''
  }
})

const emit = defineEmits(['edit'])

const onEdit = () => {
  emit('edit', props.id)
}
</script>

<style lang="scss" scoped>
.experience-item {
  background-color: #FFFFFF;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  
  .header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
    
    .main-info {
      flex: 1;
      
      .title {
        font-size: 16px;
        font-weight: 500;
        color: #333;
        margin-bottom: 4px;
      }
      
      .subtitle {
        font-size: 14px;
        color: #666;
      }
    }
    
    .edit-btn {
      padding: 4px;
      margin-left: 8px;
    }
  }
  
  .time {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
  }
  
  .divider {
    height: 1px;
    background-color: #EEEEEE;
    margin: 8px 0;
  }
  
  .content {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
  }
}
</style> 